import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;


public class ActionClassForMouseMovements {

	public static void main(String[] args) {
		
		WebDriver Driver = new FirefoxDriver();
		Driver.get("http:www.amazon.com");
		
		//Create a class called Actions and as an argument we pass Driver Object
		Actions abc = new Actions(Driver);
		//abc now have actions and driver capabilities
		WebElement element = Driver.findElement(By.xpath(".//*[@id='nav-your-account']/span[2]"));
		// create variable element  and pass it into argument
		//.build() and perform() are common methods to perform an action
		//moveToElement is used to move mouse over an element(object) on a webpage
		abc.moveToElement(element).build().perform();
        
		             // instead of creating element variable we can write the entire line 
		             // we created element variable to make the script short
		
		//abc.moveToElement(Driver.findElement(By.xpath(".//*[@id='nav-your-account']/span[2]"))).build().perform();
		
		WebElement SearchBox = Driver.findElement(By.xpath(".//*[@id='twotabsearchtextbox']"));
		abc.keyDown(SearchBox, Keys.SHIFT).sendKeys("small letters").build().perform();
		
		
		//or we can create xyz as element variable 
		
		//WebElement xyz = Driver.findElement(By.xpath(".//*[@id='twotabsearchtextbox']"));
	    //abc.keyDown(Keys.SHIFT).moveToElement(xyz).sendKeys("small").build().perform();
	    
	}

}
